package com.example.hostsys.entity;

import com.example.hostsys.payloads.AddPicPay;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;

@Entity
@Data
@JsonIgnoreProperties(value = {"house","hibernateLazyInitializer"})
@NoArgsConstructor
public class HousePics {
    public HousePics(String url){this.url=url;}
    public HousePics(AddPicPay app){
        url=app.getUrl();
        width=app.getWidth();
        height=app.getHeight();
    }
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    private String url;
    private Integer width;
    private Integer height;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "house_id")
    private House house;
}
